<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sx" uri="/struts-dojo-tags"%>
<%@include file="../includes/header.jsp"%>

<h2 class="title">Users management</h2>
<p class="meta">Manage the users data with the administration tool</p>
<s:div cssClass="entry">
	<table>
		<thead>
			<tr>
				<th>Login</th>
				<th>Last name</th>
				<th>First name</th>
				<th>Admin</th>
				<th>Favorite currency</th>
				<th colspan="3">Actions</th>
			</tr>
		</thead>
		<tbody>
			<s:sort comparator="userCompLogin" source="users">
				<s:iterator var="u" status="s">
					<tr class="<s:if test="#s.even">even</s:if><s:else>odd</s:else>">
						<td><s:property value="login" /></td>
						<td><s:property value="lastname" /></td>
						<td><s:property value="firstname" /></td>
						<td><s:if test="admin">Yes</s:if><s:else>No</s:else></td>
						<td><s:property value="favoriteCurrency.code" /> (<s:property
							value="favoriteCurrency.name" />)</td>
						<td><s:url action="detailUser" var="detail"
							includeParams="get">
							<s:param name="login" value="login" />
						</s:url><s:a href="%{detail}">
							<img src="img/actionInfo.png" title="Detail" />
						</s:a></td>
						<td><s:url action="editUserBegin" var="edit"
							includeParams="get">
							<s:param name="login" value="login" />
						</s:url><s:a href="%{edit}">
							<img src="img/actionModify.png" title="Edit" />
						</s:a></td>
						<td><s:if test="%{#session.user.login!=login}">
							<s:url action="deleteUser" var="delete" includeParams="get">
								<s:param name="login" value="login" />
							</s:url>
							<s:a href="%{delete}"
								onclick="return confirm('Are you sure you want to delete this user ?');">
								<img src="img/actionDelete.png" title="Delete" />
							</s:a>
						</s:if></td>
					</tr>
				</s:iterator>
			</s:sort>
		</tbody>
	</table>
	<p align="center"><b><i>Legend : </i></b><img
		src="img/actionInfo.png" height="12" width="12" title="Detail" /> =
	Detail <img src="img/actionModify.png" height="12" width="12"
		title="Edit" /> = Edit <img src="img/actionDelete.png" height="12"
		width="12" title="Delete" /> = Delete</p>
	<s:div style="clear: both;">&nbsp;</s:div>
	<p align="center"><s:url action="addUserBegin" var="addUser"
		includeParams="get">
		<s:param name="login" value="login" />
	</s:url><s:a href="%{addUser}">New user</s:a></p>
</s:div>

<%@include file="../includes/footer.jsp"%>
